import request from "../utils/request"
export default {
    login(user) {
        return request({
            method: "post",
            url: `/ucenter/login`,
            data: user,
        })
    },
    getUserList(page, limit) {
        return request({
            method: "get",
            url: `/ucenter/get/users/${page}/${limit}`,
            token: true,
        })
    },
    updateEnabled(userId, enabled) {
        return request({
            method: "post",
            url: '/ucenter/update/enabled',
            params: {
                userId,
                enabled,
            },
            token: true,
        })
    },
    getYesterDayCount() {
        return request({
            method: 'get',
            url: '/ucenter/yesterday/count',
            token: true,
        })
    },
    statistics(begin, end, type) {
        return request({
            method: 'get',
            url: '/ucenter/statistics',
            data: {
                begin,
                end,
                type,
            },
            token: true,
        })
    },
    essaysList(userId, page, limit, essayQuery) {
        return request({
            method: 'post',
            url: `/ucenter/get/essays/${userId}/${page}/${limit}`,
            data: essayQuery,
            token: true,
        })
    },
    deleteEssay(id, userId) {
        return request({
            method: 'delete',
            url: `/ucenter/delete/essay`,
            params: {
                id,
                userId
            },
            token: true,
        })
    },
    getEssayById(id) {
        return request({
            method: 'get',
            url: `/ucenter/essay`,
            data: {
                id
            },
            token: true,
        })
    }
}